package org.ehe.finance.receipt.enums;

/**
 * 收款方式枚举
 * @author :zhangnn
 * @className :ReceiptType
 * @description: TODO
 * @date 2025-09-02 15:17:29
 */
public enum PaymentMethod {
    CASH(1, "现金"),
    BANK_TRANSFER(2, "银行转账"),
    BILL(3, "票据"),
    OTHER(4, "其他");

    private final Integer code;
    private final String desc;

    PaymentMethod(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() { return code; }
    public String getDesc() { return desc; }

    public static String getDescByCode(Integer code) {
        for (PaymentMethod method : values()) {
            if (method.code.equals(code)) {
                return method.desc;
            }
        }
        return "未知";
    }
}
